<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数据映射</title>
</head>
<body>
<script>
/*
* 某公司1-12月的业绩
**/
    const data = { 12:0, 4:123, 5:888 };
    function dataMap(data){
     //初始化数组长度
     let newArr = new Array(12);
        //遍历每一项
        for (let i = 0; i < newArr.length;i++){
         // 将数组 和 对象
         if (data[i+1] !== undefined){
             newArr[i] = data[i+1];
         } else {
             newArr[i] = null;
         }
     }
     return newArr
    }
  console.log(dataMap(data));
</script>
</body>
</html>